import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../models/information.dart';
import '../../../widgets/load_image_widget.dart';

class InformationDetailPage extends StatelessWidget {
  const InformationDetailPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final Information information = Get.arguments;
    
    return Scaffold(
      appBar: AppBar(
        title: Text('信息详情'),
        backgroundColor: Colors.green,
      ),
      body: SingleChildScrollView(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            if (information.imageUrl != null && information.imageUrl!.isNotEmpty)
              LoadImageWidget(
                information.imageUrl!,
                width: double.infinity,
                height: 200.h,
                boxFit: BoxFit.cover,
              ),
            Padding(
              padding: EdgeInsets.all(16.w),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    information.title,
                    style: TextStyle(
                      fontSize: 22.sp,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  SizedBox(height: 8.h),
                  Text(
                    '发布时间: ${information.publishDate}',
                    style: TextStyle(
                      fontSize: 14.sp,
                      color: Colors.grey,
                    ),
                  ),
                  SizedBox(height: 16.h),
                  Text(
                    information.content,
                    style: TextStyle(
                      fontSize: 16.sp,
                      height: 1.5,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
